{% extends "base.html" %}
{% block content %}
<div class="main">
	<div class="row">
		<div class="col-md-12">
			<div class="text-wrap">
				利用hackertarget免费api接口进行信息收集
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-lg-12">
			<div class="input-group-lg">
				<input type="text" id="url" class="form-control" aria-label="..." name="url">
                <input type="hidden" id="ip" class="form-control" aria-label="..." name="ip">
                <br>
                <center>
                    <!--<button type="button" id="httpHeader" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>HTTP header information</b></button>
                    <button type="button" id="Trace_Route" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>Trace Route</b></button>
                &nbsp;&nbsp;<button type="button" id="Whois_Information" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>Whois Information</b></button>
                &nbsp;&nbsp;<button type="button" id="DNS_server_record" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>DNS server record</b></button>
                &nbsp;&nbsp;<button type="button" id="Nmap_running_services" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>Nmap- running services</b></button>
                &nbsp;&nbsp;<button type="button" id="Website_on_the_same_server" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>Website on the same server</b></button>
                &nbsp;&nbsp;<button type="button" id="Reverse_IP_Address" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>Reverse IP Address</b></button>
			    &nbsp;&nbsp;<button type="button" id="Page_Links" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>Page Links</b></button>
                    -->
                    <button type="button" id="hackertartget_All" class="btn btn-info btn-lg " aria-haspopup="true" aria-expanded="false"><b>一键全部执行</b></button>
                    <a href="" id="download" class="btn btn-info btn-lg" download="result.txt"><b>导出</b></a>
                </center>
            </div>
		</div>
    </div>
    <form action="/api/download" method="post" id="saveform">
        <input type="hidden" id="save" name="save">
    </form>
    <div class="row main-panel output">
        <div class="col-md-1"></div>
			<div class="col-md-10">
				<div id="color" class="panel panel-primary">
					<div class="panel-heading" id="result">
						提示：
					</div>
                    <div class="panel-body" id="notice" style="word-wrap:break-word; word-break:break-all;display:block">
                        最好输入www.baidu.com格式，而不是http://www.baidu.com格式，api才能识别<br><br>
                        </div>
                    <table class="table table-hover" >
                        <thead>
                            <tr>
                                <th>contents:</th>
                            </tr>
                        </thead>
                    <tbody id="t_body">
                    <!--output-->
                    </tbody>
                    </table>
                </div>
            </div>
    </div>
    <div class="row">
		<div class="col-md-10">
			<div class="text-wrap">
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			</div>
		</div>
	</div>
</div><br><br><br><br><br>
    <script type="text/javascript">
    var url="";
    var ip="";
    var daochu="";
    var query="/api/hackertartget_Alls";
    add_res="";
    var strs= new Array();
function sleep(d){
  for(var t = Date.now();Date.now() - t <= d;);
}
//sleep(2000); //当前方法暂停5秒
//setTimeout( function(){alert(("1"))}, 5 * 1000 );
function hackertartget_Alls(url){
    $("#t_body").html(JSON.stringify([{"url":url}]));
    $.post(query,JSON.stringify([{"url":url,"type":"1"}]),function (results){
        add_tmp="";
        $("#result").html("获取中1:")
        if(results){
            add_tmp=add_tmp+"header information:"+"<br>";
            strs=results.split("\r\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"2"}]),function (results){
        $("#result").html("获取中2:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"reverseiplookup:"+"<br>";
            strs=results.split("\r\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"3"}]),function (results){
        $("#result").html("获取中3:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"mtr:"+"<br>";
            strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);

    $.post(query,JSON.stringify([{"url":url,"type":"4"}]),function (results){
        $("#result").html("获取中4:");
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"whois:"+"<br>";
            strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"5"}]),function (results){
        $("#result").html("获取中5:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"dnslookup:"+"<br>";
           strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"6"}]),function (results){
        $("#result").html("获取中6:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"reversedns:"+"<br>";
            strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"7"}]),function (results){
        $("#result").html("获取中7:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"geoip:"+"<br>";
            strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"8"}]),function (results){
        $("#result").html("获取中8:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"nmap:"+"<br>";
            strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
           add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"9"}]),function (results){
        $("#result").html("获取中9:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"findshareddns:"+"<br>";
            strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);
    $.post(query,JSON.stringify([{"url":url,"type":"10"}]),function (results){
        $("#result").html("获取中10:")
        add_tmp="";
        if(results){
            add_tmp=add_tmp+"pagelinks:"+"<br>";
            strs=results.split("\n");
            for(var i=0; i<=strs.length-1;i++){
                add_tmp=add_tmp+"<br>"+strs[i];
            }
            add_res="<tr><td>"+add_tmp+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }else{
            add_res="<tr><td>"+"没有结果或到了ip100上线"+"</td></tr>"+add_res;
            $("#t_body").html(add_res);
        }
    },"json");
    sleep(2000);

}



$(function() {
    $("#hackertartget_All").click(function() {
        $("#t_body").html("")
        var url=$("#url").val();
        if(urlcheck()){
            hackertartget_Alls(url)
        }
    });


    $("#download").click(function(){
        $('#download').attr("href","data:text/plain;base64,"+btoa(daochu))
    });
});



</script>


{% endblock %}
